/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aptech.eproject.view;

import CustomeControl.CustomePanel;
import CustomeControl.CustomeButton;
import Other.Configs;
import aptech.eproject.DBConnection;
import aptech.eproject.entity.Employees;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import com.toedter.calendar.JDateChooser;
import com.toedter.calendar.JMonthChooser;
import java.sql.Date;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;

/**
 *
 * @author Loveless
 */
public class AdminManagement extends javax.swing.JFrame implements ActionListener {

    private Employees employee;
    private CustomeButton employeeButton;
    private CustomeButton billButton;
    private CustomeButton deptButton;
    private CustomeButton itemButton;
    private CustomeButton statisticButton;
    private CardLayout layout;
    private JDateChooser jDateChooser;
    private TableRowSorter sorter;
    private SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");

    public AdminManagement(Employees e) {
        initComponents();
        this.employee = e;
        CreateMenuButton();
        CustomePanel banner = new CustomePanel("build/classes/Image/Banner/Banner.jpg", 0, 0, 500, 90);
        CustomePanel avataManager = new CustomePanel("build/classes/Image/manager.png", 0, 0, 75, 80);
        pnAvataManager.add(avataManager);
        jPanel4.add(banner);
        createStatisticByDate();
        createStatisticByMonth();
        initDataStatistic();
    }

    private void CreateMenuButton() {

        jLabel2.setText(employee.getEmployeeName());
        employeeButton = new CustomeButton("Employees Master");
        employeeButton.setPreferredSize(new Dimension(150, 30));
        employeeButton.addActionListener(this);
        deptButton = new CustomeButton("Departments Master");
        deptButton.setPreferredSize(new Dimension(150, 30));
        deptButton.addActionListener(this);
        itemButton = new CustomeButton("Items Master");
        itemButton.setPreferredSize(new Dimension(150, 30));
        itemButton.addActionListener(this);
        billButton = new CustomeButton("Bills Master");
        billButton.setPreferredSize(new Dimension(150, 30));
        billButton.addActionListener(this);
        statisticButton = new CustomeButton("Statistic Master");
        statisticButton.setPreferredSize(new Dimension(150, 30));
        statisticButton.addActionListener(this);
        pnMenu.add(employeeButton);
        pnMenu.add(deptButton);
        pnMenu.add(itemButton);
        pnMenu.add(billButton);
        pnMenu.add(statisticButton);
    }

    @Override
    public void actionPerformed(ActionEvent ae) {
        EnableButton();
        if (ae.getSource() == employeeButton) {
            employeeButton.setEnabled(false);
            layout = (CardLayout) pnMain.getLayout();
            layout.show(pnMain, "Employees");
        } else if (ae.getSource() == deptButton) {
            deptButton.setEnabled(false);
            layout = (CardLayout) pnMain.getLayout();
            layout.show(pnMain, "Departments");
        } else if (ae.getSource() == itemButton) {
            itemButton.setEnabled(false);
            layout = (CardLayout) pnMain.getLayout();
            layout.show(pnMain, "Items");
        } else if (ae.getSource() == billButton) {
            billButton.setEnabled(false);
            layout = (CardLayout) pnMain.getLayout();
            layout.show(pnMain, "Bills");
        } else if (ae.getSource() == statisticButton) {
            statisticButton.setEnabled(false);
            layout = (CardLayout) pnMain.getLayout();
            layout.show(pnMain, "Statistic");
        }
    }

    public void initDataStatistic() {
        try {
            ResultSet set = DBConnection.executeSQL("SELECT I.ItemName,B.BillDate,Sum(ItemQuantiy) as [TotalQuantity],I.Price,(I.Price*Sum(ItemQuantiy)) as [TotalPrice]"
                    + " FROM Bills B Inner join BillDetails BD on(B.BillID=BD.BillID)"
                    + " inner join Items I ON(BD.ItemID=I.ItemID) "
                    + "GROUP BY B.BillDate,I.ItemName,I.Price");
            Vector list;
            DefaultTableModel model = new DefaultTableModel();
            model.addColumn("Item");
            model.addColumn("Date");
            model.addColumn("Quantity Sell");
            model.addColumn("Single Price");
            model.addColumn("Total Price");

            while (set.next()) {

                String date = dateFormat.format(set.getDate(2));
                list = new Vector();
                list.add(set.getString(1));
                list.add(date);
                list.add(set.getInt(3));
                list.add(set.getFloat(4));
                list.add(set.getFloat(5));
                model.addRow(list);
            }
            tblStatistic.setModel(model);
            sorter = new TableRowSorter(model);
            tblStatistic.setRowSorter(sorter);
            set.close();
        } catch (Exception ex) {
        } finally {

            DBConnection.disposeConnect();
        }


    }

    private void createStatisticByDate() {
        jDateChooser = new JDateChooser();
        jDateChooser.setDateFormatString("MM/dd/yyyy");
        jDateChooser.setPreferredSize(new Dimension(150, 30));
        JButton btnStatisticByDate = new JButton("Statistic");
        btnStatisticByDate.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                String keySearch = dateFormat.format(jDateChooser.getDate());
                if (keySearch.length() == 0) {
                    sorter.setRowFilter(null);
                } else {
                    sorter.setRowFilter(RowFilter.regexFilter(keySearch));
                }
            }
        });
        pnDateChoser.add(jDateChooser);
        pnDateChoser.add(btnStatisticByDate);
    }

    private void createStatisticByMonth() {
        JMonthChooser jMonthChooser = new JMonthChooser();
        jMonthChooser.setPreferredSize(new Dimension(150, 30));
        JButton btnStatisticByMonth = new JButton("Statistic");
        btnStatisticByMonth.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
            }
        });
        pnStatisticByMonth.add(jMonthChooser);
        pnStatisticByMonth.add(btnStatisticByMonth);
    }

    private void EnableButton() {
        employeeButton.setEnabled(true);
        deptButton.setEnabled(true);
        itemButton.setEnabled(true);
        billButton.setEnabled(true);
        statisticButton.setEnabled(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        privateManager = new javax.swing.JPanel();
        pnAvataManager = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        pnMenu = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        pnMain = new javax.swing.JPanel();
        pnDeparments = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        btnDeptAdd = new javax.swing.JButton();
        btnDeptUpdate = new javax.swing.JButton();
        btnDeptDelete = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jTextField1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        btnSubAdd = new javax.swing.JButton();
        btnSubUpdate = new javax.swing.JButton();
        btnSubDelete = new javax.swing.JButton();
        pnEmployees = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        btnEmpDelete = new javax.swing.JButton();
        btnEmpUpdate = new javax.swing.JButton();
        btnEmpAdd = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        pnItems = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable5 = new javax.swing.JTable();
        btnItemAdd = new javax.swing.JButton();
        btnItemUpdate = new javax.swing.JButton();
        btnItemDelete = new javax.swing.JButton();
        pnBills = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        btnAddBill = new javax.swing.JButton();
        btnUpdateBill = new javax.swing.JButton();
        btnDeleteBil = new javax.swing.JButton();
        Statistic = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tblStatistic = new javax.swing.JTable();
        pnDateChoser = new javax.swing.JPanel();
        pnStatisticByMonth = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        privateManager.setBackground(new java.awt.Color(181, 171, 189));
        privateManager.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        pnAvataManager.setBackground(new java.awt.Color(181, 171, 189));
        pnAvataManager.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnAvataManager.setLayout(new java.awt.BorderLayout());

        jLabel2.setFont(new java.awt.Font(".VnAristote", 0, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 0, 51));
        jLabel2.setText("Name");
        jLabel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout privateManagerLayout = new javax.swing.GroupLayout(privateManager);
        privateManager.setLayout(privateManagerLayout);
        privateManagerLayout.setHorizontalGroup(
            privateManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(privateManagerLayout.createSequentialGroup()
                .addGroup(privateManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(privateManagerLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(pnAvataManager, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(privateManagerLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        privateManagerLayout.setVerticalGroup(
            privateManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(privateManagerLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnAvataManager, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addContainerGap())
        );

        pnMenu.setBackground(new java.awt.Color(204, 204, 255));
        pnMenu.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addComponent(privateManager, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(privateManager, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnMenu, javax.swing.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel4.setLayout(new java.awt.BorderLayout());

        pnMain.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnMain.setLayout(new java.awt.CardLayout());

        pnDeparments.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel4.setFont(new java.awt.Font(".VnCommercial Script", 0, 36)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(0, 0, 51));
        jLabel4.setText("Department Master");

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "ID", "Name", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTable2.setColumnSelectionAllowed(true);
        jScrollPane2.setViewportView(jTable2);
        jTable2.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        btnDeptAdd.setText("Add");

        btnDeptUpdate.setText("Update");

        btnDeptDelete.setText("Delete");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 657, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 454, Short.MAX_VALUE)
                        .addComponent(btnDeptAdd)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDeptUpdate)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDeptDelete)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDeptAdd)
                    .addComponent(btnDeptUpdate)
                    .addComponent(btnDeptDelete))
                .addContainerGap(50, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Department", jPanel1);

        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "ID", "Name", "DepartmentID", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable3.setColumnSelectionAllowed(true);
        jScrollPane3.setViewportView(jTable3);
        jTable3.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        jLabel1.setText("Search");

        btnSubAdd.setText("Add");

        btnSubUpdate.setText("Update");

        btnSubDelete.setText("Delete");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 657, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addGap(0, 454, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addComponent(btnSubAdd)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnSubUpdate)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnSubDelete)))))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(9, 9, 9)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSubAdd)
                    .addComponent(btnSubUpdate)
                    .addComponent(btnSubDelete))
                .addContainerGap(122, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("SubDepartment", jPanel5);

        javax.swing.GroupLayout pnDeparmentsLayout = new javax.swing.GroupLayout(pnDeparments);
        pnDeparments.setLayout(pnDeparmentsLayout);
        pnDeparmentsLayout.setHorizontalGroup(
            pnDeparmentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDeparmentsLayout.createSequentialGroup()
                .addComponent(jLabel4)
                .addGap(0, 367, Short.MAX_VALUE))
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
        );
        pnDeparmentsLayout.setVerticalGroup(
            pnDeparmentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDeparmentsLayout.createSequentialGroup()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
        );

        pnMain.add(pnDeparments, "Departments");
        pnDeparments.getAccessibleContext().setAccessibleName("");

        pnEmployees.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        pnEmployees.setForeground(new java.awt.Color(0, 0, 51));

        jLabel3.setFont(new java.awt.Font(".VnCommercial Script", 0, 36)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(0, 0, 51));
        jLabel3.setText("Employees Master");

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "ID", "Code", "Name", "Gender", "Address", "Birth", "Mobile", "DeparmentID", "Join", "Type"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane4.setViewportView(jTable4);

        btnEmpDelete.setText("Delete");

        btnEmpUpdate.setText("Update");

        btnEmpAdd.setText("Add");
        btnEmpAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEmpAddActionPerformed(evt);
            }
        });

        jLabel8.setText("Search");

        javax.swing.GroupLayout pnEmployeesLayout = new javax.swing.GroupLayout(pnEmployees);
        pnEmployees.setLayout(pnEmployeesLayout);
        pnEmployeesLayout.setHorizontalGroup(
            pnEmployeesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnEmployeesLayout.createSequentialGroup()
                .addComponent(jLabel3)
                .addGap(0, 378, Short.MAX_VALUE))
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnEmployeesLayout.createSequentialGroup()
                .addGap(0, 479, Short.MAX_VALUE)
                .addComponent(btnEmpAdd)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnEmpUpdate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnEmpDelete))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnEmployeesLayout.createSequentialGroup()
                .addContainerGap(486, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pnEmployeesLayout.setVerticalGroup(
            pnEmployeesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnEmployeesLayout.createSequentialGroup()
                .addComponent(jLabel3)
                .addGap(8, 8, 8)
                .addGroup(pnEmployeesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnEmployeesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnEmpDelete)
                    .addComponent(btnEmpUpdate)
                    .addComponent(btnEmpAdd))
                .addGap(0, 46, Short.MAX_VALUE))
        );

        pnMain.add(pnEmployees, "Employees");
        pnEmployees.getAccessibleContext().setAccessibleName("c1");

        pnItems.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel5.setFont(new java.awt.Font(".VnCommercial Script", 0, 36)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(0, 0, 51));
        jLabel5.setText("Items Master");

        jTable5.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "ID", "Name", "Type", "Price", "Quantity", "Img", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Float.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable5.setColumnSelectionAllowed(true);
        jScrollPane5.setViewportView(jTable5);
        jTable5.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        btnItemAdd.setText("Add");

        btnItemUpdate.setText("Update");

        btnItemDelete.setText("Delete");

        javax.swing.GroupLayout pnItemsLayout = new javax.swing.GroupLayout(pnItems);
        pnItems.setLayout(pnItemsLayout);
        pnItemsLayout.setHorizontalGroup(
            pnItemsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnItemsLayout.createSequentialGroup()
                .addComponent(jLabel5)
                .addGap(0, 467, Short.MAX_VALUE))
            .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnItemsLayout.createSequentialGroup()
                .addContainerGap(479, Short.MAX_VALUE)
                .addComponent(btnItemAdd)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnItemUpdate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnItemDelete))
        );
        pnItemsLayout.setVerticalGroup(
            pnItemsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnItemsLayout.createSequentialGroup()
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnItemsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnItemAdd)
                    .addComponent(btnItemUpdate)
                    .addComponent(btnItemDelete))
                .addGap(0, 72, Short.MAX_VALUE))
        );

        pnMain.add(pnItems, "Items");

        pnBills.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel6.setFont(new java.awt.Font(".VnCommercial Script", 0, 36)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(0, 0, 51));
        jLabel6.setText("Bills Master");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "ID", "Date", "DepartmentID", "EmployeeID", "CouponID", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setColumnSelectionAllowed(true);
        jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        btnAddBill.setText("Add");

        btnUpdateBill.setText("Update");

        btnDeleteBil.setText("Delete");

        javax.swing.GroupLayout pnBillsLayout = new javax.swing.GroupLayout(pnBills);
        pnBills.setLayout(pnBillsLayout);
        pnBillsLayout.setHorizontalGroup(
            pnBillsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnBillsLayout.createSequentialGroup()
                .addComponent(jLabel6)
                .addGap(0, 492, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnBillsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnBillsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnBillsLayout.createSequentialGroup()
                        .addGap(0, 420, Short.MAX_VALUE)
                        .addComponent(btnAddBill, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnUpdateBill)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDeleteBil)
                        .addGap(31, 31, 31))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnBillsLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 662, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        pnBillsLayout.setVerticalGroup(
            pnBillsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnBillsLayout.createSequentialGroup()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnBillsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAddBill)
                    .addComponent(btnUpdateBill)
                    .addComponent(btnDeleteBil))
                .addContainerGap(50, Short.MAX_VALUE))
        );

        pnMain.add(pnBills, "Bills");

        Statistic.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel7.setFont(new java.awt.Font(".VnCommercial Script", 0, 36)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(0, 0, 51));
        jLabel7.setText("Statistic Master");

        tblStatistic.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Item", "Date", "Quantity Sell", "Price", "Total Price"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Float.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblStatistic.setColumnSelectionAllowed(true);
        jScrollPane6.setViewportView(tblStatistic);
        tblStatistic.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        pnDateChoser.setBorder(javax.swing.BorderFactory.createTitledBorder("Statistic by date"));
        pnDateChoser.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        pnStatisticByMonth.setBorder(javax.swing.BorderFactory.createTitledBorder("Statistic by month"));
        pnStatisticByMonth.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        javax.swing.GroupLayout StatisticLayout = new javax.swing.GroupLayout(Statistic);
        Statistic.setLayout(StatisticLayout);
        StatisticLayout.setHorizontalGroup(
            StatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(StatisticLayout.createSequentialGroup()
                .addComponent(jLabel7)
                .addGap(0, 431, Short.MAX_VALUE))
            .addGroup(StatisticLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(StatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 654, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, StatisticLayout.createSequentialGroup()
                        .addComponent(pnDateChoser, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 102, Short.MAX_VALUE)
                        .addComponent(pnStatisticByMonth, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        StatisticLayout.setVerticalGroup(
            StatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(StatisticLayout.createSequentialGroup()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(StatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnDateChoser, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                    .addComponent(pnStatisticByMonth, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(73, 73, 73))
        );

        pnMain.add(Statistic, "Statistic");

        jMenu1.setText("Menu");
        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 694, Short.MAX_VALUE)
                    .addComponent(pnMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnEmpAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEmpAddActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_btnEmpAddActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Statistic;
    private javax.swing.JButton btnAddBill;
    private javax.swing.JButton btnDeleteBil;
    private javax.swing.JButton btnDeptAdd;
    private javax.swing.JButton btnDeptDelete;
    private javax.swing.JButton btnDeptUpdate;
    private javax.swing.JButton btnEmpAdd;
    private javax.swing.JButton btnEmpDelete;
    private javax.swing.JButton btnEmpUpdate;
    private javax.swing.JButton btnItemAdd;
    private javax.swing.JButton btnItemDelete;
    private javax.swing.JButton btnItemUpdate;
    private javax.swing.JButton btnSubAdd;
    private javax.swing.JButton btnSubDelete;
    private javax.swing.JButton btnSubUpdate;
    private javax.swing.JButton btnUpdateBill;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTable jTable5;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JPanel pnAvataManager;
    private javax.swing.JPanel pnBills;
    private javax.swing.JPanel pnDateChoser;
    private javax.swing.JPanel pnDeparments;
    private javax.swing.JPanel pnEmployees;
    private javax.swing.JPanel pnItems;
    private javax.swing.JPanel pnMain;
    private javax.swing.JPanel pnMenu;
    private javax.swing.JPanel pnStatisticByMonth;
    private javax.swing.JPanel privateManager;
    private javax.swing.JTable tblStatistic;
    // End of variables declaration//GEN-END:variables
}
